home *** CD-ROM | disk | FTP | other *** search
/ System Booster / System Booster.iso / Archives / ForCLI / wk102.lha / WhatKick / WhatKick.c next >
Encoding:
C/C++ Source or Header  |  1992-08-01  |  850 b   |  37 lines

  1. // WhatKick 1.02 (C) 1991,1992 Conrad Sanderson
  2. // Use precompiled headers and don't link this with anything
  3.  
  4. void _main()
  5. {
  6.     short ver;
  7.     long script;
  8.  
  9.     struct FileHandle *input;
  10.     struct Process *process;
  11.     struct CommandLineInterface *cli;
  12.     struct DosLibrary *DOSBase;
  13.  
  14.     if(!(DOSBase=(struct DosLibrary *)OldOpenLibrary("dos.library")))
  15.         goto exit;
  16.  
  17.     ver=DOSBase->dl_lib.lib_Version;
  18.  
  19.     if(ver>34) script=(long)&("s:new-start");
  20.     else script=(long)&("s:old-start");
  21.  
  22.     if(!(input = (struct FileHandle *)Open((char *)script,MODE_OLDFILE)))
  23.         goto closedos;
  24.  
  25.     process = (struct Process *)FindTask(NULL); // casting sux severly
  26.     cli = (struct CommandLineInterface *)BADDR(process->pr_CLI);
  27.  
  28.     if(cli->cli_CurrentInput !=Input() ) Close(cli->cli_CurrentInput);  // argh!
  29.     cli->cli_CurrentInput  = (BPTR)input;
  30.  
  31. closedos:
  32.  
  33.     CloseLibrary(DOSBase);
  34.  
  35. exit:;
  36. }
  37.